﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using ClientDependency.Core.Controls;
using ClientDependency.Core;
using DigibizTree.Shared;


namespace DigibizTree.Picker
{
    /// <summary>
    /// Extension methods for this namespace
    /// </summary>
    public static class DigibizPickerExtensions
    {

        /// <summary>
        /// Adds the JS/CSS required for the DigibizPicker.
        /// </summary>
        /// <param name="ctl"></param>
        public static void AddAllDAMPClientDependencies(this Control ctl)
        {
            //get the urls for the embedded resources
            AddCssDAMPClientDependencies(ctl);
            AddJsDAMPClientDependencies(ctl);
        }

        /// <summary>
        /// Adds the CSS required for the DigibizPicker.
        /// </summary>
        /// <param name="ctl"></param>
        public static void AddCssDAMPClientDependencies(this Control ctl)
        {
            var cssName = "DigibizTree.Picker.DigibizPickerStyles.css";
            ctl.AddResourceToClientDependency(cssName, ClientDependencyType.Css);
        }

        /// <summary>
        /// Adds the JS required for the DigibizPicker.
        /// </summary>
        /// <param name="ctl"></param>
        public static void AddJsDAMPClientDependencies(this Control ctl)
        {
            var jsDigibizPicker = "DigibizTree.Picker.DigibizPickerScripts.js";
            ctl.AddResourceToClientDependency(jsDigibizPicker, ClientDependencyType.Javascript);
        }

    }
}
